package com.zhentao.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhentao.nlz.project.dto.VehicleInformationDto;
import com.zhentao.nlz.project.product.TVehicleInformation;
import com.zhentao.product.service.TVehicleInformationService;
import com.zhentao.product.mapper.TVehicleInformationMapper;
import com.zhentao.utils.Result;
import org.springframework.stereotype.Service;

/**
* @author 不.凌
* @description 针对表【t_vehicle_information(车牌记录表)】的数据库操作Service实现
* @createDate 2024-10-09 14:56:59
*/
@Service
public class TVehicleInformationServiceImpl extends ServiceImpl<TVehicleInformationMapper, TVehicleInformation>
    implements TVehicleInformationService{

    @Override
    public Result vehicleInformationList(VehicleInformationDto vehicleInformationDto) {
        Page<TVehicleInformation> page = new Page<>(vehicleInformationDto.getPageNum(),vehicleInformationDto.getPageSize());
        LambdaQueryWrapper<TVehicleInformation> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(StringUtils.isNotBlank(vehicleInformationDto.getPalteNumber()),TVehicleInformation::getPalteNumber,vehicleInformationDto.getPalteNumber());
        this.page(page,wrapper);
        return Result.success(page);
    }

    @Override
    public Result vehicleInformationAdd(TVehicleInformation vehicleInformation) {
        boolean save = this.save(vehicleInformation);
        return Result.success(save);
    }

    @Override
    public Result vehicleInformationUpdate(TVehicleInformation vehicleInformation) {
        boolean update = this.updateById(vehicleInformation);
        return Result.success(update);
    }

    @Override
    public Result vehicleInformationDelete(Integer id) {
        boolean delete = this.removeById(id);
        return Result.success(delete);
    }
}




